<?php
/**
 * 肤质检测项目模型
 * Author: lyun
 * Date: 2018/7/25
 * Created by Panxsoft.
 */


namespace App\Models\Panx\Tags;

use App\Models\Panx\ProductTag;
use App\Models\Panx\SkinDetector;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;

/**
 * @property-read Collection productTags
 * @property int item_id - 检测项目编号（wax 对应 itemsid ）
 */
class SkinDetectionItem extends Model
{
    protected $table = 'skin_detection_items';
    protected $guarded = [];

    protected $casts = [
        'item_id' => 'int',
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function productTags()
    {
        return $this->belongsToMany(ProductTag::class, 'product_tag_pivot_skin_detection_item', 'skin_detection_item_id', 'product_tag_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function skinDetector()
    {
        return $this->belongsTo(SkinDetector::class, 'skin_detector_id', 'id');
    }
}
